#include<stdio.h>

int main()
{
    int a, b;
    char c;
    double x;
    scanf("%d %d %c", &a, &b, &c);
    if(b == 90)
    {
        x = 6.95 * a;
    }
    else if(b == 93)
    {
        x = 7.44 * a;
    }
    else
    {
        x = 7.93 * a;
    }
    if(c == 'm')
    {
        x = x * 0.95;
    }
    else
    {
        x = x * 0.97;
    }
    printf("%.2f", x);
    
    return 0;
}